positioned-io
This crate allows you to specify an offset for reads and writes, without changing the current
position in a file. This is similar to pread()
and pwrite()
in C.
The major advantages of this type of I/O are:
- You don't need to seek before doing a random-access read or write, which is convenient.
- Reads don't modify the file at all, so don't require mutability.
Example
Read the fifth 512-byte sector of a file:
use ReadAt;
// Note that file does not need to be mut!
let file = try!;
let mut buf = vec!;
let bytes_read = try!;
Documentation
http://vasi.github.io/positioned-io/positioned_io/
Usage
This crate works with Cargo and is on
crates.io. Add it to your Cargo.toml
like so:
[]
= "0.2.0"